<!--  -->
<template>
  <div class="price-detail">
    <template v-for="(item,index) in 10">
      <div
        @click="toActivityDetail(item)"
        class="detail-item show_public flex"
        :key="index"
        v-if="tabIndex==0"
      >
        <img :src="item.pic_cover_small" alt="">
        <div class="flex-1 ml-10 f-14">
          <div class="ellipsis w-250">奖励产品: {{item.name}}</div>
          <div class="flex justify-between mt-8">
            <span> 
              购买
              <span class="color-red">{{item.num}}</span>件商品
            </span>
            <span class="mr-10">
              订单金额
              <span class="color-red">{{item.total_money}}</span>元
            </span>
          </div>
          <div class="mt-8">
            获取
            <span class="color-red">{{item.total_powerA}}</span>幸运号码
          </div>
          <div class="progress-wrapper mt-10 mr-10">
            <div class="progress" :style="{width:item.progress+'%'}"></div>
          </div>
          <div class="flex mt-10 justify-between aligin-center f-12 mr-10">
            <div class="flex aligin-center">
              <span class="power"></span>
              <span>{{item.current}}</span>
            </div>
            <div class="flex aligin-center">
              <span class="receive-count"></span>
              <span>{{item.power}}</span>
            </div>
          </div>
        </div>
      </div>
      <div class="detail-item show_public" :class="[tabIndex==2?'pb-0':'']" :key="index" v-else>
        <div class="flex aligin-center" @click="toDetail(item)">
          <img :src="item.pic_cover_small" alt="">
          <div class="flex-1 ml-10 f-14">
            <div class="flex">
              <div class="label-item">期号:{{item.issue_id}}</div>
              <div class="label-item">幸运号:{{item.luck_number}}</div>
            </div>
            <div class="flex mt-8">
              <div class="label-item">获奖者:</div>
              <div class="label-item">{{item.luck_name}}</div>
            </div>
            <div class="flex mt-8">
              <div class="label-item">揭晓时间:</div>
              <div class="label-item  f-8">{{item.open_time}}</div>
            </div>
            <div class="flex mt-8">
              <div class="label-item">订单金额:{{item.total_money}}</div>
              <div class="label-item">能量贡献:{{item.give_power}}</div>
            </div>
          </div>
        </div>
        <div v-if="tabIndex==2">
          <div class="bottom-bar f-12 flex justify-between aligin-center">
            <router-link tag="div"  :to="{name:'service',query:{shop_id:item.shop_id}}" class="flex aligin-center">
              <span class="service"></span>
              <span class="ml-6">联系客服</span>
            </router-link>
            <div class="flex f-14">
              <router-link
                tag="span"
                :to="{name:'deliverDetail',params:{id:item.order_no}}"
                class="btn-item flex justify-center aligin-center"
              >查看物流</router-link>
              <router-link
                v-if="item.is_evaluate==0&&item.type==0"
                tag="span"
                :to="{name:'shareWinOrder',params:{id:item.id,order_id:item.order_id,key:item.key}}"
                class="btn-item border-red flex justify-center aligin-center color-red ml-10"
              >分享晒单</router-link>
            </div>
          </div>
        </div>
      </div>
    </template>
    <div class="no-data" v-if="detailList.length==0"></div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    detailList: {
      type: Array,
      default: () => {
        return [];
      },
      required: true
    },
    tabIndex: {
      type: Number,
      default: () => {
        return 0;
      },
      required: true
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {
    toActivityDetail(item){
       this.$router.push({ name: "detail", params: { id: item.id } });
    },
    toDetail(item) {
      this.$router.push({
        name: "recordList",
        params: { id: item.id, key: item.key,issue_id:item.issue_id }
      });
    }
  },
  created() {},
  mounted() {},
  updated() {}, //生命周期 - 更新之后
  destroyed() {} //生命周期 - 销毁完成
};
</script>
<style lang='less' scoped>
@import url("../assets/style/mixin");
.f-8 {
  font-size: 8px;
}
.h-14{
  height: 16px;
}
.w-250 {
  width: 220px;
}
.price-detail {
  padding: 0 5px;
  .detail-item {
    margin-bottom: 12px;
    padding: 20px 0;
    img {
      height: 90px;
      width: 90px;
      border-radius: 4px;
    }
    .flex-1 {
      flex: 1;
    }
    .progress-wrapper {
      position: relative;
      height: 6px;
      background: #eee;
      border-radius: 3px;
    }
    .progress {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      border-radius: 3px;
      .bg-1();
    }
    .power {
      display: inline-block;
      width: 14px;
      height: 14px;
      .bg-image("../../assets/imgs/power");
      background-size: 100% 100%;
    }
    .receive-count {
      display: inline-block;
      width: 14px;
      height: 14px;
      .bg-image("../../assets/imgs/receive");
      background-size: 100% 100%;
    }
    .label-item {
      width: 50%;
    }
    .bottom-bar {
      padding: 0 16px;
      height: 48px;
      width: 100%;
      box-sizing: border-box;
      background: #fff;
      z-index: 100;
      .service {
        height: 16px;
        width: 16px;
        background: url("../assets/imgs/tabBottom/serviceSelected.png");
        background-size: 100% 100%;
      }
      .btn-item {
        height: 25px;
        width: 76px;
        border: 1px solid rgba(188, 188, 188, 1);
        border-radius: 5px;
      }
      .border-red {
        border: 1px solid rgba(234, 55, 63, 1);
      }
    }
  }
  .pb-0 {
    padding-bottom: 0;
  }
}
</style>